package com.atguigu.a_bufferedreader;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class Demo {
    public static void main(String[] args) throws IOException {
        //创建输入流对象指向源文件
        BufferedReader br = new BufferedReader(new FileReader("T_Day23\\test\\Demo1.java"));

        //一次读一行
        String line; //存储每次读到的一行字符

        while((line = br.readLine()) != null){
            //输出内容 -> 不读换行符,所以手动加换行
            System.out.println(line);
        }


        br.close();
    }

    private static void extracted(BufferedReader br) throws IOException {
        String line = br.readLine(); //读一行但是不读换行符
        System.out.println(line);

        line = br.readLine(); //读一行但是不读换行符
        System.out.println(line);

        line = br.readLine(); //读一行但是不读换行符
        System.out.println(line);

        line = br.readLine(); //读一行但是不读换行符
        System.out.println(line);

        System.out.println(br.readLine());
        System.out.println(br.readLine());
        System.out.println(br.readLine());
        System.out.println(br.readLine());
        System.out.println(br.readLine());
    }
}
